<template>
    <div class="back">
        <div class="p1">当前搜索关键词：<a href="#">{{ Share_resource.resource_name }}</a></div>
        <div class="line">
            <hr>
        </div>
        <div class="tit">
            <form action="">
                <input class="i1" type="text" placeholder="请输入搜索内容" v-model="Share_resource.resource_name">
                <button class="btn1" type="submit" @click="init">点击搜索</button>
            </form>
        </div>
        <div>

            <ul v-for="sr in Share_resourceList">
                <div class="item">
                    <div class="divleft">1号大厅</div>
                    <div class="divright">
                        <p @click="isShow=!isShow">{{isShow?"收起 ▽":"展开 △"}}</p>
                    </div>
                    <div style="clear: both; overflow: hieedn;"></div>
                </div>
                <div v-show="isShow">
                    <li v-for="s in sr.value">
                        <div class="d1">
                            <div class="msg">{{ s.resource_name }} 链接：<a href="#">{{ s.create_by }}云盘</a> {{ s.resource_pw }}</div>
                            <input class="cbtn" type="button" value="复制链接">
                            <br>
                        </div>
                        <div class="bl">

                        </div>
                    </li>
                </div>
                
            </ul>
        </div>
    </div>
</template>

<script setup>

import { inject, reactive, ref, toRefs } from 'vue';

const axios = inject('axios');
const data = reactive({
    Share_resource: {
        resource_name: ''
    }
});
const bdata = reactive({
    Share_resourceList: []
});

const Share_resource = toRefs(data);
const Share_resourceList = toRefs(bdata);
const init = () => {
    let url = 'resourse/selectByName';
    axios.post(url, {
        "resource_name": Share_resource.resource_name
    })
        .then(Response => {
            console.log(Response.data);
            bdata.Share_resourceList = Response.data;
            console.log(Share_resourceList);
            for (let s of bdata.Share_resourceList) {
                if(s.resource_pw==""){
                }else{
                    s.resource_pw = "提取码:"+s.resource_pw;
                }
                s.isShow = false;
                console.log(s);
            }
        })
        .catch(error => {
            console.log(error);
        })
}

const isShow = ref(false)
</script>

<style>
.bl{
    width: 100%;
    height: 12px;
    background-image: url("@/assets/bl.png");
}
.d1 a{
    text-decoration: none;
    color: rgb(105, 144, 216);
    font-size: 18px;
}
.d1 a:hover{
    text-decoration:underline;
    color: rgb(250, 19, 19);
}
.msg{
    line-height: 60px;
    font-size: 18px;
    height: 75%;
    /* border: 1px solid #bfa; */
}

.d1{
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    height: 85px;
    border-top: 1px solid rgb(122, 122, 133);
    padding: 10px 10px;
    border-width:1px 0px;
    border-top-width: 3px;
     box-shadow:0px 2px 2px 0px #ccc inset;

}
li{
    margin: 20px 0;
    /* border: 1px solid red; */

}

.cbtn{
    background-color: #0069be;
    color: white;
    margin-left: 92%;
    border-radius: 20px;
    padding: 2px 8px;
    border-width: 0px;
    font-size: 12px;
}
.tit{
    margin-bottom: 10px;
    font-size: 0px;
}
.btn1{
    font-weight:bold;
    background-color: #007BFF;
    color: white;
    font-size: 18px;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    width: 25%;
    height: 45px;
    border-width: 0px;
    vertical-align: top;
}

.i1{
    text-indent:10px;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    width: 75%;
    height: 45px;
    border-width: 0.5px;
}
.p1{
    margin-top: 20px;
}
ul{
    list-style: none;
}
hr {
    border: 1px solid rgb(253, 123, 123);
}

.line {
    margin: 10px 0px;
}

.back {
    width: 40%;
    margin: auto;
}

.divleft{
    float: left;
    color: red;
    font-size: 18px;
}
.divright{
    margin-top: 5px;
    float: right;
    font-size: 16px;
}
.divright p{
    cursor:pointer;
}
body{
    min-width: 1800px;
    overflow: scroll;
  
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-size: 14px;
}
</style>